Repository navigation
Fix the Windows CMake build with clang-cl - #242
Merged
Merged
Conversation
getReason() returns a std::string. Passing it through the variadic
GFXSTREAM_INFO() is undefined behavior: the log can show incorrect text
or the process can stop. The code is in an _WIN32 block. clang-cl
rejects it (-Wnon-pod-varargs), so the Windows CMake build fails.
Use getReason().c_str().
Test: Windows CMake build with clang-cl (VS 2026, SDK 10.0.26100),
target gfxstream_backend.
Assisted-by: Claude Code:Claude-Opus-5.5
sys/time.h includes WinSock2.h. When Windows.h comes first, it includes
the older winsock.h, and WinSock2.h then redefines its types. With
Windows SDK 10.0.26100 and clang-cl, the Windows CMake build fails in
time.cpp ("redefinition of 'sockaddr'").
Include sys/time.h first.
Test: clean Windows CMake build with clang-cl (VS 2026, SDK 10.0.26100),
default flags, target gfxstream_backend.
Assisted-by: Claude Code:Claude-Opus-5.5
gurchetansingh
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #240.
The Windows CMake build of
gfxstream_backendfails with clang-cl:common/base/windows/src/time.cpp:Windows.hcomes beforesys/time.h, which includesWinSock2.h.Windows.hincludes the olderwinsock.h, and the two conflict.host/vulkan/vk_common_operations.cpp: astd::stringgoes to%sinGFXSTREAM_INFO().This is undefined behavior. clang-cl rejects it.
Fix
time.cpp: include<sys/time.h>before<Windows.h>.vk_common_operations.cpp: passgetReason().c_str().Test
Clean Windows CMake build, Visual Studio 2026, clang-cl 20, Windows SDK 10.0.26100, default flags,
target
gfxstream_backend: completes. Without thetime.cppchange, the build stops intime.cpp. With only thetime.cppchange, it stops invk_common_operations.cpp.This change was developed with AI assistance (Claude Code; see the
Assisted-bytrailers).